package com.ctshk.rpc.starvip.factory.member;

import com.ctshk.rpc.starvip.dto.start_vip.member.ListOfMembers;
import com.ctshk.rpc.starvip.dto.start_vip.member.Member;
import com.ctshk.rpc.starvip.dto.start_vip.member.MemberOperation;
import com.ctshk.rpc.starvip.dto.start_vip.user.ListOfLoyMembershipCard;
import com.ctshk.rpc.starvip.dto.start_vip.user.LoyMembershipCard;
import com.ctshk.rpc.starvip.factory.StarVipReqProvider;
import com.ctshk.rpc.starvip.req.member.MembershipVerificationReq;
import com.google.common.collect.Lists;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.rpc.starvip.factory.member
 * @Author: hef
 * @CreateTime: 2021-04-12 17:39
 * @Description: 会员身份验证
 */
public class MembershipVerificationFactory extends StarVipReqProvider<MembershipVerificationReq> {


    public MembershipVerificationFactory(MembershipVerificationReq membershipVerificationReq) {
        super(membershipVerificationReq);
    }

    @Override
    public MemberOperation produce() {
        MemberOperation membershipVerification = new MemberOperation();
        membershipVerification.setListOfMembers(new ListOfMembers());
        membershipVerification.setMessageId("1-MDSD");
        membershipVerification.setIntObjectName("CTS Member Validation");
        membershipVerification.setInterfaceId("CTS_IF_16");
        membershipVerification.setOperation("Query");
        membershipVerification.setMessageType("Integration Object");
        membershipVerification.setIntObjectFormat("Siebel Hierarchical");
        membershipVerification.setXmlns("http://www.siebel.com/xml/LOY_Member");
        membershipVerification.setListOfMembers(new ListOfMembers(
                Lists.newArrayList(
                        new Member(req.getCtsMemberId(), req.getCtsPassword(), req.getContactEmailAddress(),
                                req.getCtsContactIdNum(), req.getCtsContactIdType(), req.getCtsContactMobilePhone(),
                                req.getCtsLogin(),
                                new ListOfLoyMembershipCard(
                                Lists.newArrayList(
                                        new LoyMembershipCard()
                                                .setCardNumber(req.getCardNumber())
                                                .setCardType(req.getCardType())
                                ))
                        )
                )
        ));
        return membershipVerification;
    }
}
